﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Blam_Unity.Classes.Engine.Halo_AA.Game_Executable_Level
{
    class physicsConstant
    {
        /// <summary>
        /// Get the Single Player/Firefight Physic Constant
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <param name="isCompressed">bool saying if the xex is compressed</param>
        /// <returns></returns>
        public static float readSPPhysicsConstant(MojosIO mio, bool isCompressed)
        {
            if (isCompressed == true)
            {
                mio.Position = 0x4C248;
                return mio.ReadInt32();
            }
            else
            {
                mio.Position = 0x4C248;
                return mio.ReadInt32();
            }
        }

        /// <summary>
        /// Get the Multiplayer Physic Constant
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <param name="isCompressed">bool saying if the xex is compressed</param>
        /// <returns></returns>
        public static float readMPPhysicsConstant(MojosIO mio, bool isCompressed)
        {
            if (isCompressed == true)
            {
                mio.Position = 0x3FB78;
                return mio.ReadInt32();
            }
            else
            {
                mio.Position = 0x3FB78;
                return mio.ReadInt32();
            }
        }

        /// <summary>
        /// Write Multiplayer Physic Constant
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <param name="isCompressed">bool saying if the xex is compressed</param>
        /// <param name="mpPhysicsConstant">New Multiplayer physics constant value</param>
        public static void writeMPPhysicsConstant(MojosIO mio, bool isCompressed, float mpPhysicsConstant)
        {
            if (isCompressed == true)
            {
                mio.Position = 0x3FB78;
                mio.Write(mpPhysicsConstant);
            }
            else
            {
                mio.Position = 0x3FB78;
                mio.Write(mpPhysicsConstant);
            }
        }

        /// <summary>
        /// Write Single Player/Firefight Physic Constant
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <param name="isCompressed">bool saying if the xex is compressed</param>
        /// <param name="spPhysicsConstant">New Singleplayer/Firefight physics constant value</param>
        public static void writeSPPhysicsConstant(MojosIO mio, bool isCompressed, float spPhysicsConstant)
        {
            if (isCompressed == true)
            {
                mio.Position = 0x4C248;
                mio.Write(spPhysicsConstant);
            }
            else
            {
                mio.Position = 0x4C248;
                mio.Write(spPhysicsConstant);
            }
        }
    }
}
